<script setup>
import {ref} from "vue";
// 导入枪神纪logo图片
import gunz2Logo from '@/assets/game-logos/TPS.png';

document.title = "3D资源分享站 - 枪神纪资源中心";
const categories = [
  { 
    id: 'characters', 
    title: "角色模型", 
    href: "/gunz2/characters", 
    description: "游戏角色3D模型资源",
    icon: "👤"
  },
  { 
    id: 'weapons', 
    title: "武器模型", 
    href: "/gunz2/weapons", 
    description: "游戏武器3D模型资源",
    icon: "⚔️"
  }
];

const run = ref(true)
const goTo = (href) => {
  run.value = !run.value
  location.href = href
}
</script>

<template>
  <div class="categories-container">
    <!-- 面包屑导航 -->
    <div class="breadcrumb">
      <span class="breadcrumb-item" @click="$router.push('/index')">首页</span>
      <span class="breadcrumb-separator">/</span>
      <span class="breadcrumb-item active">枪神纪</span>
    </div>

    <!-- 页面标题 -->
    <div class="page-header">
      <div class="game-info">
        <div class="game-icon">
          <img :src="gunz2Logo" alt="枪神纪" class="game-logo" />
        </div>
        <div class="game-text">
          <h1 class="page-title">枪神纪</h1>
          <p class="page-subtitle">游戏内3D模型、武器、场景资源分享</p>
        </div>
      </div>
    </div>

    <!-- 分类网格 -->
    <transition name="fade" appear>
      <div v-if="run" class="categories-grid">
        <div 
          v-for="(category, index) in categories" 
          :key="category.id" 
          class="category-card"
          :style="{ animationDelay: `${index * 0.1}s` }"
          @click="goTo(category.href)"
        >
          <div class="card-content">
            <div class="category-icon-container">
              <div class="category-icon-display">{{ category.icon }}</div>
            </div>
            
            <div class="category-info">
              <h3 class="category-title">{{ category.title }}</h3>
              <p class="category-description">{{ category.description }}</p>
              <div class="category-stats">
                <span class="stat-item">
                  <span class="stat-icon">⭐</span>
                  <span class="stat-text">精选</span>
                </span>
                <span class="stat-item">
                  <span class="stat-icon">🔧</span>
                  <span class="stat-text">可用</span>
                </span>
              </div>
            </div>
          </div>
          
          <!-- 卡片边框发光效果 -->
          <div class="card-glow"></div>
        </div>
      </div>
    </transition>
  </div>
</template>

<style scoped>
.categories-container {
  padding: 20px 0;
}

.breadcrumb {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 30px;
  font-size: 14px;
  color: var(--accent-silver);
}

.breadcrumb-item {
  cursor: pointer;
  transition: color 0.3s ease;
}

.breadcrumb-item:hover {
  color: var(--accent-blue);
}

.breadcrumb-item.active {
  color: var(--accent-blue);
  cursor: default;
}

.breadcrumb-separator {
  color: var(--accent-silver);
}

.page-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 40px;
  animation: fadeInUp 0.8s ease-out;
}

.game-info {
  display: flex;
  align-items: center;
  gap: 20px;
}

.game-icon {
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  animation: pulse 2s ease-in-out infinite;
}

.game-logo {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.3));
}

.game-text {
  text-align: left;
}

.page-title {
  font-size: 36px;
  font-weight: 700;
  background: linear-gradient(135deg, var(--accent-blue), var(--white));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin: 0 0 10px 0;
}

.page-subtitle {
  font-size: 18px;
  color: var(--accent-silver);
  margin: 0;
  font-weight: 300;
}

.categories-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(400px, 1fr));
  gap: 30px;
  padding: 20px 0;
}

.category-card {
  position: relative;
  background: var(--gradient-card);
  border: 1px solid rgba(79, 70, 229, 0.3);
  border-radius: 20px;
  overflow: hidden;
  cursor: pointer;
  transition: all 0.4s ease;
  animation: fadeInUp 0.6s ease-out both;
  backdrop-filter: blur(10px);
}

.category-card:hover {
  transform: translateY(-10px) scale(1.02);
  border-color: var(--accent-blue);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.4), 0 0 30px rgba(79, 70, 229, 0.3);
}

.card-content {
  position: relative;
  z-index: 2;
  padding: 40px;
  text-align: center;
}

.category-icon-container {
  margin-bottom: 30px;
}

.category-icon-display {
  font-size: 80px;
  margin-bottom: 20px;
  animation: pulse 2s ease-in-out infinite;
}

.category-info {
  text-align: center;
}

.category-title {
  font-size: 32px;
  font-weight: 700;
  color: var(--white);
  margin: 0 0 15px 0;
}

.category-description {
  font-size: 16px;
  color: var(--accent-silver);
  text-align: center;
  margin: 0 0 25px 0;
  line-height: 1.6;
}

.category-stats {
  display: flex;
  justify-content: center;
  gap: 20px;
  flex-wrap: wrap;
}

.stat-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 15px;
  background: rgba(79, 70, 229, 0.1);
  border: 1px solid rgba(79, 70, 229, 0.3);
  border-radius: 15px;
  color: var(--accent-blue);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.stat-icon {
  font-size: 14px;
}

.card-glow {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 20px;
  opacity: 0;
  transition: all 0.4s ease;
  pointer-events: none;
}

.category-card:hover .card-glow {
  opacity: 1;
  animation: glow 2s ease-in-out infinite;
}

/* 动画效果 */
.fade-enter-active {
  animation: fadeInUp 0.8s ease-out;
}

.fade-leave-active {
  animation: fadeOutDown 0.5s ease-in;
}

/* 响应式设计 */
@media (max-width: 768px) {
  .page-header {
    flex-direction: column;
    gap: 20px;
    text-align: center;
  }
  
  .game-info {
    flex-direction: column;
    text-align: center;
  }
  
  .game-text {
    text-align: center;
  }
  
  .page-title {
    font-size: 28px;
  }
  
  .page-subtitle {
    font-size: 16px;
  }
  
  .categories-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }
  
  .card-content {
    padding: 30px 20px;
  }
  
  .category-icon-display {
    font-size: 60px;
  }
  
  .category-title {
    font-size: 24px;
  }
  
  .category-description {
    font-size: 14px;
  }
  
  .category-stats {
    gap: 15px;
  }
  
  .stat-item {
    padding: 6px 12px;
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .categories-grid {
    gap: 15px;
  }
  
  .card-content {
    padding: 25px 15px;
  }
  
  .category-icon-display {
    font-size: 50px;
  }
  
  .category-title {
    font-size: 20px;
  }
  
  .category-stats {
    flex-direction: column;
    gap: 10px;
  }
}
</style>
